/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.edu.gobesco.managedbean;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;


/**
 *
 * @author Edwin Chía
 * @Fecha: 23/10/2011
 */
@ManagedBean
@ViewScoped
public class CargarPaginaBean implements Serializable{

    

    /** Creates a new instance of CargarPaginaBean */
    public CargarPaginaBean() {

	this.pageInclude = "welcome.xhtml";

    }


    private String pageInclude;

    public String getPageInclude() {
	return pageInclude;
    }

    public void setPageInclude(String pageInclude) {
	this.pageInclude = pageInclude;
    }

    public void cambiarPageInclude() {
	FacesContext context = FacesContext.getCurrentInstance();

	String nombreIntem = (String) context.getExternalContext().getRequestParameterMap().get("current");

	System.out.println("[CargarPaginaBean]nombreIntem: " + nombreIntem);

	if (nombreIntem != null && nombreIntem.equals("Inicio")) {
	    this.pageInclude = "welcome.xhtml";
	} else if (nombreIntem != null && nombreIntem.equals("Personas")) {
	    this.pageInclude = "personas/ges_personas.xhtml";
	} else if (nombreIntem != null && nombreIntem.equals("TipoPersona")) {
	    this.pageInclude = "personas/ges_tipopersona.xhtml";
	}else if (nombreIntem != null && nombreIntem.equals("Procesos")) {
	    this.pageInclude = "procesos/ges_proceso.xhtml";
	}

	System.out.println("[CargarPaginaBean]pageInclude: "+this.pageInclude);
    }

}
